package valueobject

type PatchOption[T any] func(p *Patch[T])

func NewPatch[T any](opts ...PatchOption[T]) PatchVO {
	var patch Patch[T]
	for _, opt := range opts {
		opt(&patch)
	}
	return &patch
}

func WithPatchOP[T any](op string) PatchOption[T] {
	return func(p *Patch[T]) {
		p.Option = op
	}
}

func WithPatchPath[T any](path string) PatchOption[T] {
	return func(p *Patch[T]) {
		p.Path = path
	}
}

func WithPatchFrom[T any](from string) PatchOption[T] {
	return func(p *Patch[T]) {
		p.From = from
	}
}

func WithPatchValue[T any](value T) PatchOption[T] {
	return func(p *Patch[T]) {
		p.Value = value
	}
}
